<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery.min.js" type="text/javascript"></script>
    <script src="js/ruku/rukubanli.js" type="text/javascript"></script>
    <script>
        function checktime() {
            var zdata = new Date(document.getElementById("billDate").value.replace("//-/g", "//"));
            var wdata = new Date(document.getElementById("billEditTime").value.replace("//-/g", "//"));
            if(wdata<zdata){
                alert("结算日期不能小于开始日期")
            }else {
                alert("日期格式正确")
            }
        }
        function lastpage(page) {
            var dingweiId = $("#dingweiId").val();
            var billDate = $("#billDate").val();
            var billEditTime = $("#billEditTime").val();
            var huozhuName = $("#huozhuName").val();
            var rukudanhao = $("#rukudanhao").val();
            var pagerows = $("#pageRows").val();
            window.location = "hwrkuSelectData.do?newpageNum="+page+"&pageRows="+pagerows+"&billDate="+billDate+"&billEditTime="+billEditTime+"&huozhuName="+huozhuName+"&rukudanhao="+rukudanhao+"&dingweiId="+dingweiId;
        }
        function lastpage1(row) {
            var billDate = $("#billDate").val();
            var billEditTime = $("#billEditTime").val();
            var huozhuName = $("#huozhuName").val();
            var rukudanhao = $("#rukudanhao").val();
            var pageNum = $("#pageNum").val();
            var dingweiId = $("#dingweiId").val();
            window.location = "hwrkuSelectData.do?newpageNum="+pageNum+"&pageRows="+row+"&huozhuName="+huozhuName+"&rukudanhao="+rukudanhao+"&billDate="+billDate+"&billEditTime="+billEditTime+"&dingweiId="+dingweiId;
        }
    </script>
</head>
<body>
<form action="hwrkuSelectData.do">
    <input type="hidden" value="3" name="dingweiId" id="dingweiId">
    <h3><font color="blue">入库管理>>></font><font color="blue">入库单明细查询</font></h3>
    <h4><font color="blue">查询</font></h4>
    <table border="1" style="border: skyblue" width="1200px">
        <tr><td>入库时间</td><td colspan="5"><input type="text" placeholder="yyyy-MM-dd" id="billDate" name="billDate">/<input type="text" placeholder="yyyy-MM-dd"  id="billEditTime" name="billEditTime" onblur="checktime()"></td></tr>
        <tr><td>入库单号</td><td colspan="5"><input type="text"  id="rukudanhao" name="rukudanhao"></td></tr>
        <tr><td>货主名</td><td colspan="5"><input type="text"  id="huozhuName" name="huozhuName" ></td></tr>
        <tr><td></td><td colspan="5"><button id="check">查询</button></td></tr>
        <tr>
            <td rowspan="3" colspan="6">每页显示条数:
                <select name="pageRows" id="pageRows" onchange="lastpage1(this.value)">
                    <option th:each="i:${session.list}" th:text="${i}" th:value="${i}" th:selected="${session.pageRows == i}"></option>
                </select>
                第<label th:text="${session.pageInfo.getPageNum()}"></label>页
                <input type="hidden" th:value="${session.pageInfo.getPageNum()}" id="pageNum">
            </td>
        </tr>
        <tr></tr><tr></tr>
        <!--        <tr><td><input type="text"></td><td><input type="text"></td><td><input type="text"></td><td><input type="text"></td><td><input type="text"></td><td><input type="text"></td></tr>-->



    </table>
</form>

<label th:if="${session.pageInfo.size==0}" style="color: #ff4400">没有查到任何数据!请核对查询信息</label>
<table id="table2" th:if="${session.pageInfo.size!=0}" border="1" style="border: skyblue" width="1200px">
    <tr><td>明细号</td><td>货主</td><td>托盘</td><td>货物名称</td><td>验货员</td><td>仓管员</td><td>入库数量</td><td>规格</td><td>当前数量</td><td>编辑时间</td><td>是否删除</td></tr>
    <tr th:each="everyBillDetails:${session.pageInfo.getList()}">
        <td><input type="radio" name="eveBillsRuKuMingXiId" th:value="${everyBillDetails.detailsID}" id="eveBillsRuKuMingXiId" onclick="huoQuShuJu(this.value)"><span th:text="${everyBillDetails.detailsID}"></span></td>

        <td th:text="${everyBillDetails.custName}"></td>
        <td th:text="${everyBillDetails.trayID}"></td>
        <td th:text="${everyBillDetails.detailsGoodsName}"></td>
        <td th:text="${everyBillDetails.detailsAffirmant}"></td>

        <td th:text="${everyBillDetails.detailsConservator}"></td>
        <td th:text="${everyBillDetails.detailsGoodsNum}"></td>
        <td th:text="${everyBillDetails.detailsGoodsSpec}"></td>
        <td th:text="${everyBillDetails.currentGoodsNum}"></td>
        <td th:text="${everyBillDetails.detailsEditTime}"></td>
        <td th:text="${everyBillDetails.detailsIsDel}"></td>

    </tr>
    <tr><button th:value="${session.pageInfo.getPageNum()>1?session.pageInfo.getPageNum()-1:session.pageInfo.getPageNum()}" onclick="lastpage(this.value)">上一页</button>
        <button th:value="${session.pageInfo.getPageNum()<session.pageInfo.getSize()?session.pageInfo.getPageNum()+1:session.pageInfo.getPageNum()}" onclick="lastpage(this.value)">下一页</button></tr>
</table>

    <table border="1" style="border: skyblue" width="1200px">
        <tr>
            <td colspan="1" >业务单明细号:</td><td colspan="5"><input type="text" id="mingxihao"></td>
        </tr>
        <tr>
            <td colspan="1">商品名称:</td><td colspan="5"><input type="text" id="shangpinmingcheng"></td>
        </tr>
        <tr>
            <td style="width: 150px">规格:</td><td colspan="5"><input type="text" id="guige"></td>
        </tr>
        <tr>
            <td style="width: 150px">件数:</td><td colspan="5"><input type="text" id="jianshu"></td>
        </tr>
<!--        <tr>-->
<!--            <td></td><td colspan="5"><input type="submit" value="提交"></td>-->
<!--        </tr>-->
    </table>


</form>
</body>
<script type="text/javascript">

    function huoQuShuJu(eveBillsRuKuMingXiId) {
        var  eveId66 = document.getElementsByName("eveBillsRuKuMingXiId")
        for (let i = 0; i < eveId66.length; i++) {
            if (eveId66[i].checked==true){
                // alert(eveBillsRuKuMingXiId);
                $.ajax({
                    type:"post",
                    url:"selectDetilsByHeDId.do?eveBillsRuKuMingXiId="+eveBillsRuKuMingXiId,
                    success:function (data) {
                        $("#mingxihao").val(data.detailsId)
                        $("#shangpinmingcheng").val(data.detailsGoodsName)
                        $("#guige").val(data.detailsGoodsSpec)
                        $("#jianshu").val(data.detailsGoodsNum)

                    }
                })
            }
        }
    }
</script>
</html>